import requests
class IhrmCurd:
    @classmethod
    def create(cls,header,body,session):
        url="http://ihrm-test.itheima.net/api/sys/user"
        res=session.post(url=url,headers=header,json=body)
        return res
    @classmethod
    def query(cls,id,header,session):
        url="http://ihrm-test.itheima.net/api/sys/user/{}".format(id)
        res = session.get(url=url, headers=header)
        return res
    @classmethod
    def modify(cls,id,header,data,session):
        url= "http://ihrm-test.itheima.net/api/sys/user/{}".format(id)
        res = session.put(url=url, headers=header, json=data)
        return res
    @classmethod
    def delete(cls,id,header,session):
        url = "http://ihrm-test.itheima.net/api/sys/user/{}".format(id)
        session = requests.Session()
        res = session.delete(url=url, headers=header)
        return res




if __name__ == '__main__':
    header={"Content-Type":"application/json","Authorization":"9e40b5a4-553e-4062-94f2-307b90b20084"}
    body={"username":"张三","mobile":"157273979521","workNumber":"002"}
    session =requests.Session()
    res=IhrmCurd.create(header,body,session)
    print(res.json())
    """
    ihrm_id="1505197733198290944"
    header={"Content-Type":"application/json","Authorization":"9e40b5a4-553e-4062-94f2-307b90b20084"}
    res=IhrmCurd.query(ihrm_id,header,session)
    print(res.json())
   """